import 'package:flutter/material.dart';

class BasicDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return ContainerDemo();
  }
}

class ContainerDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(
              'https://t7.baidu.com/it/u=4104132798,2145996313&fm=193&f=GIF',
            ),
            alignment: Alignment.topCenter,
            fit: BoxFit.cover,
            colorFilter: ColorFilter.mode(
              Colors.purpleAccent,
              BlendMode.hardLight,
            ),
          ),
        ),
        // color: Colors.black12,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              child: Icon(
                Icons.pool,
                size: 32,
                color: Colors.white,
              ),
              // color: Colors.red,
              padding: EdgeInsets.all(15),
              margin: EdgeInsets.all(20),
              width: 100,
              height: 120,
              decoration: BoxDecoration(
                color: Colors.yellow,
                border: Border.all(
                  color: Colors.indigoAccent,
                  width: 5,
                  style: BorderStyle.solid,
                ),
                boxShadow: [
                  BoxShadow(
                    offset: Offset(5, 10),
                    color: Colors.cyanAccent,
                    spreadRadius: -5,
                    blurRadius: 5,
                  ),
                ],
                // borderRadius: BorderRadius.circular(16),
                shape: BoxShape.circle,
                // gradient: RadialGradient(
                //   colors: [Colors.red, Colors.deepPurple],
                // ),
                gradient: LinearGradient(
                  colors: [Colors.red, Colors.deepPurple],
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                ),
              ),
            ),
            TextDemo(),            RichTextDemo(),

          ],
        ));
  }
}

class RichTextDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return RichText(
        text: TextSpan(
            text: 'ninghao',
            style: TextStyle(
              color: Colors.yellow,
              fontSize: 34,
              fontStyle: FontStyle.italic,
              fontWeight: FontWeight.w100,
            ),
            children: [
          TextSpan(
              text: ".net",
              style: TextStyle(
                fontSize: 15,
                color: Colors.green,
              )),
        ]));
  }
}

class TextDemo extends StatelessWidget {
  final TextStyle _textStyle = TextStyle(
    fontSize: 16,
  );
  final String _author = 'fff';
  final String _title = 'aaa';

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Text(
      "需要$_title需要$_author需要$_title需要$_author需要$_title需要$_author需要$_title需要$_author需要$_title需要$_author需要$_title需要$_author需要$_title需要$_author",
      textAlign: TextAlign.center,
      style: _textStyle,
      maxLines: 1,
      overflow: TextOverflow.ellipsis,
    );
  }
}
